#include "lib/3d/pvm3dinterface.h"
#include "pvm/pvmapi.h"

#include "lib/memory/pvmmemory.h"

#ifndef PVM3DSOFTWARECLASSNAME
#error "PVM3DSOFTWARECLASSNAME undefined!"
#endif

class PVM3DSOFTWARECLASSNAME : public IPVM3DInterface, public PVMAllocableObject
{
protected:
	void*	listener;
public:
	PVM3DSOFTWARECLASSNAME(PVMDEVICE device);
	virtual ~PVM3DSOFTWARECLASSNAME();

	virtual pvm_int32 GetRealizationType();//hardware, software float or fixed point

	virtual void Update();

	virtual pvm_bool Enable();
	virtual void Disable();

	virtual pvm_bool GetSupportedDistanceModels(pvm_int32* model);
	virtual pvm_bool SetDistanceModel(pvm_int32 model);
	virtual pvm_bool GetDistanceModel(pvm_int32* model);

	virtual pvm_bool ControlEnable(pvm_int32 chanelNum);
	virtual pvm_bool ControlDisable(pvm_int32 chanelNum);
	virtual pvm_bool IsControlEnabled(pvm_int32 chanelNum);

	virtual pvm_bool SetStopOnDistance(pvm_int32 chanelNum, pvm_bool flag);
	virtual pvm_bool SetVoiceRate(pvm_int32 chanelNum, pvm_int32 value);
	virtual pvm_bool SetVoiceMaxVolume(pvm_int32 chanelNum, pvm_int32 value);

	virtual pvm_bool GetStopOnDistance(pvm_int32 chanelNum, pvm_bool* flag);
	virtual pvm_bool GetVoiceRate(pvm_int32 chanelNum, pvm_int32* value);
	virtual pvm_bool GetVoiceMaxVolume(pvm_int32 chanelNum, pvm_int32* value);

	//scalar dependent
	//floating point
	virtual pvm_bool SetListenerPosition_f(float x, float y, float z);
	virtual pvm_bool SetListenerVelocity_f(float x, float y, float z);
	virtual pvm_bool SetListenerOrientation_f(float xFront, float yFront, float zFront, float xTop, float yTop, float zTop);
	virtual pvm_bool SetDopplerFactor_f(float factor);
	virtual pvm_bool SetUnitSize_f(float size);

	virtual pvm_bool GetListenerPosition_f(float* x, float* y, float* z);
	virtual pvm_bool GetListenerVelocity_f(float* x, float* y, float* z);
	virtual pvm_bool GetListenerOrientation_f(float* xFront, float* yFront, float* zFront, float* xTop, float* yTop, float* zTop);
	virtual pvm_bool GetDopplerFactor_f(float* factor);
	virtual pvm_bool GetUnitSize_f(float* size);

	virtual pvm_bool SetVoicePosition_f(pvm_int32 chanelNum, float x, float y, float z);
	virtual pvm_bool SetVoiceVelocity_f(pvm_int32 chanelNum, float x, float y, float z);
	virtual pvm_bool SetVoiceDirection_f(pvm_int32 chanelNum, float x, float y, float z);
	virtual pvm_bool SetVoiceMinDistance_f(pvm_int32 chanelNum, float d);
	virtual pvm_bool SetVoiceMaxDistance_f(pvm_int32 chanelNum, float d);
	virtual pvm_bool SetRolloffFactor_f(pvm_int32 chanelNum, float factor);

	virtual pvm_bool GetVoicePosition_f(pvm_int32 chanelNum, float* x, float* y, float* z);
	virtual pvm_bool GetVoiceVelocity_f(pvm_int32 chanelNum, float* x, float* y, float* z);
	virtual pvm_bool GetVoiceDirection_f(pvm_int32 chanelNum, float* x, float* y, float* z);
	virtual pvm_bool GetVoiceMinDistance_f(pvm_int32 chanelNum, float* d);
	virtual pvm_bool GetVoiceMaxDistance_f(pvm_int32 chanelNum, float* d);
	virtual pvm_bool GetRolloffFactor_f(pvm_int32 chanelNum, float* factor);

	//fixed point
	virtual pvm_bool SetListenerPosition_x(pvm_int32 x, pvm_int32 y, pvm_int32 z);
	virtual pvm_bool SetListenerVelocity_x(pvm_int32 x, pvm_int32 y, pvm_int32 z);
	virtual pvm_bool SetListenerOrientation_x(pvm_int32 xFront, pvm_int32 yFront, pvm_int32 zFront, pvm_int32 xTop, pvm_int32 yTop, pvm_int32 zTop);
	virtual pvm_bool SetDopplerFactor_x(pvm_int32 factor);
	virtual pvm_bool SetUnitSize_x(pvm_int32 size);

	virtual pvm_bool GetListenerPosition_x(pvm_int32* x, pvm_int32* y, pvm_int32* z);
	virtual pvm_bool GetListenerVelocity_x(pvm_int32* x, pvm_int32* y, pvm_int32* z);
	virtual pvm_bool GetListenerOrientation_x(pvm_int32* xFront, pvm_int32* yFront, pvm_int32* zFront, pvm_int32* xTop, pvm_int32* yTop, pvm_int32* zTop);
	virtual pvm_bool GetDopplerFactor_x(pvm_int32* factor);
	virtual pvm_bool GetUnitSize_x(pvm_int32* size);

	virtual pvm_bool SetVoicePosition_x(pvm_int32 chanelNum, pvm_int32 x, pvm_int32 y, pvm_int32 z);
	virtual pvm_bool SetVoiceVelocity_x(pvm_int32 chanelNum, pvm_int32 x, pvm_int32 y, pvm_int32 z);
	virtual pvm_bool SetVoiceDirection_x(pvm_int32 chanelNum, pvm_int32 x, pvm_int32 y, pvm_int32 z);
	virtual pvm_bool SetVoiceMinDistance_x(pvm_int32 chanelNum, pvm_int32 d);
	virtual pvm_bool SetVoiceMaxDistance_x(pvm_int32 chanelNum, pvm_int32 d);
	virtual pvm_bool SetRolloffFactor_x(pvm_int32 chanelNum, pvm_int32 factor);

	virtual pvm_bool GetVoicePosition_x(pvm_int32 chanelNum, pvm_int32* x, pvm_int32* y, pvm_int32* z);
	virtual pvm_bool GetVoiceVelocity_x(pvm_int32 chanelNum, pvm_int32* x, pvm_int32* y, pvm_int32* z);
	virtual pvm_bool GetVoiceDirection_x(pvm_int32 chanelNum, pvm_int32* x, pvm_int32* y, pvm_int32* z);
	virtual pvm_bool GetVoiceMinDistance_x(pvm_int32 chanelNum, pvm_int32* d);
	virtual pvm_bool GetVoiceMaxDistance_x(pvm_int32 chanelNum, pvm_int32* d);
	virtual pvm_bool GetRolloffFactor_x(pvm_int32 chanelNum, pvm_int32* factor);
};
